





<!DOCTYPE html>
<html class="writer-html5" lang="zh-CN" >
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>tvm.relay.transform &mdash; tvm 0.8.dev1982 文档</title>
  

  
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <link rel="stylesheet" href="../../../../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../../../../_static/gallery.css" type="text/css" />
  <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../../_static/css/tlcpack_theme.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../../_static/tvm-logo-square.png"/>
  

  
  
  
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../../" src="../../../../_static/documentation_options.js"></script>
        <script data-url_root="../../../../" id="documentation_options" src="../../../../_static/documentation_options.js"></script>
        <script src="../../../../_static/jquery.js"></script>
        <script src="../../../../_static/underscore.js"></script>
        <script src="../../../../_static/doctools.js"></script>
        <script src="../../../../_static/translations.js"></script>
    
    <script type="text/javascript" src="../../../../_static/js/theme.js"></script>

    
    <script type="text/javascript" src="../../../../_static/js/tlcpack_theme.js"></script>
    <link rel="index" title="索引" href="../../../../genindex.html" />
    <link rel="search" title="搜索" href="../../../../search.html" />
    <link rel="next" title="tvm.relay.analysis" href="analysis.html" />
    <link rel="prev" title="tvm.relay.image" href="image.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    
<header class="header">
    <div class="innercontainer">
      <div class="headerInner d-flex justify-content-between align-items-center">
          <div class="headerLogo">
               <a href="https://tvm.apache.org/"><img src=https://tvm.apache.org/assets/images/logo.svg alt="logo"></a>
          </div>

          <div id="headMenu" class="headerNav">
            <button type="button" id="closeHeadMenu" class="navCloseBtn"><img src="../../../../_static/img/close-icon.svg" alt="Close"></button>
             <ul class="nav">
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/community>Community</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/download>Download</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/vta>VTA</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/blog>Blog</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/docs>Docs</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvmconf.org>Conference</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://github.com/apache/tvm/>Github</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvmchinese.github.io/declaration_zh_CN.html>About-Translators</a>
                </li>
             </ul>
               <div class="responsivetlcdropdown">
                 <button type="button" class="btn-link">
                   ASF
                 </button>
                 <ul>
                     <li>
                       <a href=https://apache.org/>Apache Homepage</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/licenses/>License</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/sponsorship.html>Sponsorship</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/security/>Security</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/thanks.html>Thanks</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/events/current-event>Events</a>
                     </li>
                     <li>
                       <a href=https://www.zhihu.com/column/c_1429578595417563136>Zhihu</a>
                     </li>
                 </ul>
               </div>
          </div>
            <div class="responsiveMenuIcon">
              <button type="button" id="menuBtn" class="btn-menu"><img src="../../../../_static/img/menu-icon.svg" alt="Menu Icon"></button>
            </div>

            <div class="tlcDropdown">
              <div class="dropdown">
                <button type="button" class="btn-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                  ASF
                </button>
                <div class="dropdown-menu dropdown-menu-right">
                  <ul>
                     <li>
                       <a href=https://apache.org/>Apache Homepage</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/licenses/>License</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/sponsorship.html>Sponsorship</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/security/>Security</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/thanks.html>Thanks</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/events/current-event>Events</a>
                     </li>
                     <li>
                       <a href=https://www.zhihu.com/column/c_1429578595417563136>Zhihu</a>
                     </li>
                  </ul>
                </div>
              </div>
          </div>
       </div>
    </div>
 </header>
 
    <nav data-toggle="wy-nav-shift" class="wy-nav-side fixed">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="../../../../index.html">
          

          
            
            <img src="../../../../_static/tvm-logo-small.png" class="logo" alt="Logo"/>
          
          </a>

          
            
            
                <div class="version">
                  0.8.dev1982
                </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption" role="heading"><span class="caption-text">如何开始</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../../install/index.html">安装 TVM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../contribute/index.html">贡献者指南</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">用户引导</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../../tutorial/index.html">User Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../how_to/index.html">How To Guides</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">开发者引导</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../../dev/tutorial/index.html">Developer Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../dev/how_to/how_to.html">开发者指南</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">架构指南</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../../arch/index.html">Design and Architecture</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">主题引导</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../../topic/microtvm/index.html">microTVM：裸机使用TVM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../topic/vta/index.html">VTA: Versatile Tensor Accelerator</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">参考指南</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../langref/index.html">语言参考</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">Python API</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../runtime.html">tvm.runtime</a></li>
<li class="toctree-l2"><a class="reference internal" href="../ndarray.html">tvm.runtime.ndarray</a></li>
<li class="toctree-l2"><a class="reference internal" href="../error.html">tvm.error</a></li>
<li class="toctree-l2"><a class="reference internal" href="../ir.html">tvm.ir</a></li>
<li class="toctree-l2"><a class="reference internal" href="../ir.html#module-tvm.instrument">tvm.instrument</a></li>
<li class="toctree-l2"><a class="reference internal" href="../ir.html#module-tvm.transform">tvm.transform</a></li>
<li class="toctree-l2"><a class="reference internal" href="../target.html">tvm.target</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tir.html">tvm.tir</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tir.html#module-tvm.tir.transform">tvm.tir.transform</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tir.html#tvm-tir-analysis">tvm.tir.analysis</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tir.html#module-tvm.tir.stmt_functor">tvm.tir.stmt_functor</a></li>
<li class="toctree-l2"><a class="reference internal" href="../te.html">tvm.te</a></li>
<li class="toctree-l2"><a class="reference internal" href="../te.html#module-tvm.te.hybrid">tvm.te.hybrid</a></li>
<li class="toctree-l2"><a class="reference internal" href="../driver.html">tvm.driver</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html">tvm.relay</a></li>
<li class="toctree-l2"><a class="reference internal" href="frontend.html">tvm.relay.frontend</a></li>
<li class="toctree-l2"><a class="reference internal" href="nn.html">tvm.relay.nn</a></li>
<li class="toctree-l2"><a class="reference internal" href="vision.html">tvm.relay.vision</a></li>
<li class="toctree-l2"><a class="reference internal" href="image.html">tvm.relay.image</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">tvm.relay.transform</a></li>
<li class="toctree-l2"><a class="reference internal" href="analysis.html">tvm.relay.analysis</a></li>
<li class="toctree-l2"><a class="reference internal" href="backend.html">tvm.relay.backend</a></li>
<li class="toctree-l2"><a class="reference internal" href="dataflow_pattern.html">tvm.relay.dataflow_pattern</a></li>
<li class="toctree-l2"><a class="reference internal" href="testing.html">tvm.relay.testing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../autotvm.html">tvm.autotvm</a></li>
<li class="toctree-l2"><a class="reference internal" href="../auto_scheduler.html">tvm.auto_scheduler</a></li>
<li class="toctree-l2"><a class="reference internal" href="../rpc.html">tvm.rpc</a></li>
<li class="toctree-l2"><a class="reference internal" href="../micro.html">tvm.micro</a></li>
<li class="toctree-l2"><a class="reference internal" href="../contrib.html">tvm.contrib</a></li>
<li class="toctree-l2"><a class="reference internal" href="../graph_executor.html">tvm.contrib.graph_executor</a></li>
<li class="toctree-l2"><a class="reference internal" href="../topi.html">tvm.topi</a></li>
<li class="toctree-l2"><a class="reference internal" href="../vta/index.html">vta</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../links.html">Other APIs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../publications.html">Publications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../../genindex.html">索引</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
      
      <nav class="wy-nav-top" aria-label="top navigation" data-toggle="wy-nav-top">
        
            <div class="togglemenu">

            </div>
            <div class="nav-content">
              <!-- tvm -->
              Table of content
            </div>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        

          




















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../../index.html">Docs</a> <span class="br-arrow">></span></li>
        
          <li><a href="../index.html">Python API</a> <span class="br-arrow">></span></li>
        
      <li>tvm.relay.transform</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="../../../../_sources/reference/api/python/relay/transform.rst.txt" rel="nofollow"> <img src="../../../../_static//img/source.svg" alt="viewsource"/></a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="module-tvm.relay.transform">
<span id="tvm-relay-transform"></span><h1>tvm.relay.transform<a class="headerlink" href="#module-tvm.relay.transform" title="永久链接至标题">¶</a></h1>
<p>The Relay IR namespace containing transformations.</p>
<p><strong>函数：</strong></p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">recast</span></code>(expr, dtype, out_dtype[, ops, …])</p></td>
<td><p>Convert the types of operations in a graph to a new value.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">AlterOpLayout</span></code>()</p></td>
<td><p>Alternate the layouts of operators or replace primitive operators with other expressions.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">AnnotateSpans</span></code>()</p></td>
<td><p>Annotate a program with span information by first generating its textual representation and then parsing it back into a Relay AST annotated with span information.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">AnnotateTarget</span></code>(targets[, include_non_call_ops])</p></td>
<td><p>Annotate ops in an experession with a provied compiler/target and then use it for codegen.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">BackwardFoldScaleAxis</span></code>()</p></td>
<td><p>Backward fold axis scaling into weights of conv2d/dense.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">BatchingOps</span></code>()</p></td>
<td><p>Batching parallel operators into one for Conv2D, Dense and BatchMatmul.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">CanonicalizeCast</span></code>()</p></td>
<td><p>Canonicalize cast expressions to make operator fusion more efficient.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">CanonicalizeOps</span></code>()</p></td>
<td><p>Canonicalize special operators to basic operators.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">CombineParallelBatchMatmul</span></code>([min_num_branches])</p></td>
<td><p>Combine multiple batch matmul operators into one.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">CombineParallelConv2D</span></code>([min_num_branches])</p></td>
<td><p>Combine multiple conv2d operators into one.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">CombineParallelDense</span></code>([min_num_branches, …])</p></td>
<td><p>Combine multiple dense operators into one.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">Conv2dToSparse</span></code>(weight_name, weight_shape, …)</p></td>
<td><p>Rewrite qualified <code class="docutils literal notranslate"><span class="pre">`nn.conv2d</span> <span class="pre">operation`</span></code> to <code class="docutils literal notranslate"><span class="pre">`nn.sparse_conv2d`</span></code></p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">Conv2dToSparse2</span></code>(layout, kernel_size, …)</p></td>
<td><p>Rewrite freezed <code class="docutils literal notranslate"><span class="pre">`nn.conv2d`</span></code> operation to <code class="docutils literal notranslate"><span class="pre">`nn.sparse_conv2d`</span></code></p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">ConvertLayout</span></code>(desired_layouts)</p></td>
<td><p>Given a dest layout, this pass transforms the expr such that most of the ops input data layout is changed to the dest layout.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">DeadCodeElimination</span></code>([inline_once])</p></td>
<td><p>Remove expressions that do not have any users (dead code).</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">Defunctionalization</span></code>(func, mod)</p></td>
<td><p>Performs defunctionalization on func, transforming func from a higher-order program to a first-order program.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">DefuseOps</span></code>()</p></td>
<td><p>The inverse operation of FuseOps.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">DenseToSparse</span></code>(weight_name, weight_shape)</p></td>
<td><p>Rewrite qualified <code class="docutils literal notranslate"><span class="pre">`nn.dense</span> <span class="pre">operation`</span></code> to <code class="docutils literal notranslate"><span class="pre">`nn.sparse_dense`</span></code> This pass is used in <code class="docutils literal notranslate"><span class="pre">`data_dep_optimization.bsr_dense`</span></code> Parameters of this pass is generated by <code class="docutils literal notranslate"><span class="pre">`analysis.sparse_dense.process_params`</span></code></p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">DynamicToStatic</span></code>()</p></td>
<td><p>If possible, convert tvm.relay.dynamic* ops to static versions</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">EliminateCommonSubexpr</span></code>([fskip])</p></td>
<td><p>Eliminate common subexpressions.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">EtaExpand</span></code>([expand_constructor, …])</p></td>
<td><p>Add abstraction over a constructor or global variable bound to a function</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">FakeQuantizationToInteger</span></code>()</p></td>
<td><p>Find regions of the graph of the form</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">FastMath</span></code>()</p></td>
<td><p>Converts the expensive non linear functions to their fast but approximate counterparts.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">FirstOrderGradient</span></code>()</p></td>
<td><p>Transforms all global functions in the module to return the original result, paired with the gradients of the inputs.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">FoldConstant</span></code>()</p></td>
<td><p>Fold the constant expressions in a Relay program.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">FoldConstantExpr</span></code>(expr, mod)</p></td>
<td><p>Fold the constant expressions in a Relay program.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">FoldExplicitPadding</span></code>()</p></td>
<td><p>FoldExplicitPadding finds explict padding before an op that can support implicit padding and fuses them.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">FoldScaleAxis</span></code>()</p></td>
<td><p>Fold the scaling of axis into weights of conv2d/dense.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">ForwardFoldScaleAxis</span></code>()</p></td>
<td><p>Fold the scaling of axis into weights of conv2d/dense.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">FuseOps</span></code>([fuse_opt_level])</p></td>
<td><p>Fuse operators in an expr to a larger operator according to some rules.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">InferType</span></code>()</p></td>
<td><p>Infer the type of an expr.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">Inline</span></code>()</p></td>
<td><p>Perform inlining on the given Relay IR module.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">LambdaLift</span></code>()</p></td>
<td><p>Lift the closure to global function.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">LazyGradientInit</span></code>()</p></td>
<td><p>Reduces memory usage of gradient tensors</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">Legalize</span></code>([legalize_map_attr_name])</p></td>
<td><p>Legalizes an expression with another expression.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">MergeCompilerRegions</span></code>()</p></td>
<td><p>Merge together compiler regions.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">MergeComposite</span></code>(pattern_table)</p></td>
<td><p>Merge multiple operators into a single composite relay function.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">PartialEvaluate</span></code>()</p></td>
<td><p>Evaluate the static fragment of the code.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">PartitionGraph</span></code>([mod_name])</p></td>
<td><p>Partition a Relay program into regions that can be executed on different backends.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">PlanDevices</span></code>(default_device)</p></td>
<td><p>Uses existing “on_device” and “device_copy” CallNodes to infer the device on which every Relay sub-expression should run (and the result stored).</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">RemoveUnusedFunctions</span></code>([entry_functions])</p></td>
<td><p>Remove unused global relay functions in a relay module.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">SimplifyExpr</span></code>()</p></td>
<td><p>Simplify the Relay expression, including merging consecutive reshapes.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">SimplifyFCTranspose</span></code>(target_weight_name)</p></td>
<td><p>Rewrite <code class="docutils literal notranslate"><span class="pre">`y</span> <span class="pre">=</span> <span class="pre">nn.dense(x,</span> <span class="pre">transpose(w,</span> <span class="pre">[1,</span> <span class="pre">0]))`</span></code> to <code class="docutils literal notranslate"><span class="pre">`y</span> <span class="pre">=</span> <span class="pre">nn.dense(x,</span> <span class="pre">wt)`</span></code> This pass is used in <code class="docutils literal notranslate"><span class="pre">`data_dep_optimization.simplify_fc_transpose`</span></code></p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">SimplifyInference</span></code>()</p></td>
<td><p>Simplify the data-flow graph for inference phase.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">SplitArgs</span></code>(max_function_args)</p></td>
<td><p>Split function with huge number of arguments to smaller pieces.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">ToANormalForm</span></code>()</p></td>
<td><p>Turn Graph Normal Form expression into A Normal Form Expression.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">ToANormalFormExpr</span></code>(e)</p></td>
<td><p>ToANormalForm, but on expression level.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">ToBasicBlockNormalForm</span></code>()</p></td>
<td><p>Turn an expression to Basic Block Normal Form.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">ToCPS</span></code>(expr[, mod])</p></td>
<td><p>Turn expression into continuation passing style(CPS).</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">ToGraphNormalForm</span></code>()</p></td>
<td><p>Turn a Relay program in A Normal Form into Graph Normal Form</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">ToMixedPrecision</span></code>([mixed_precision_type, …])</p></td>
<td><p>Automatic mixed precision rewriter.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">build_config</span></code>([opt_level, required_pass, …])</p></td>
<td><p>Configure the build behavior by setting config variables.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">function_pass</span></code>([pass_func, opt_level, name, …])</p></td>
<td><p>Decorate a function pass.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">gradient</span></code>(expr[, mod, mode])</p></td>
<td><p>Transform the input function, returning a function that calculate the original result, paired with gradient of the input.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">to_cps</span></code>(func[, mod])</p></td>
<td><p>Turn expression into CPS expression.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">un_cps</span></code>(func)</p></td>
<td><p>Turn an cps function into a Function without the continuation argument.</p></td>
</tr>
</tbody>
</table>
<p><strong>类：</strong></p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">ChangeBatch</span></code>(data[, batch_size])</p></td>
<td><p>Change the batch size.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">FunctionPass</span></code>()</p></td>
<td><p>A pass that works on each tvm.relay.Function in a module.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">LayoutConfig</span></code>([skip_layers])</p></td>
<td><p>A structure for customizing the ConvertLayout pass.</p></td>
</tr>
</tbody>
</table>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.recast">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">recast</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dtype</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">out_dtype</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ops</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">skip_layers</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.recast" title="永久链接至目标">¶</a></dt>
<dd><p>Convert the types of operations in a graph to a new value.
Note that this is primarily useful for testing performance of individual
operations at the new datatype. In a real setting, this pass will
almost certainly do a poor job converting from one datatype to another
as it just applies hard casting. For example, when recasting from float
to integer, many small values will simply be set to 0. Although this will
allow autotuning and benchmarking to produce proper timings at the new
data type, the output of the model will of course be heavily impacted.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>expr</strong> (<em>tvm.relay.Expr</em><em>, </em><em>tvm.relay.Function</em><em>, or </em><a class="reference internal" href="../ir.html#tvm.ir.IRModule" title="tvm.ir.IRModule"><em>tvm.ir.IRModule</em></a>) – The original function that will have its type changed.</p></li>
<li><p><strong>dtype</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The target type to cast to.</p></li>
<li><p><strong>out_dtype</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The output type to cast to.</p></li>
<li><p><strong>ops</strong> (<a class="reference internal" href="dataflow_pattern.html#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em>) – A list of operations that should have their type changed,
others will be left as is.</p></li>
<li><p><strong>skip_layers</strong> (<a class="reference internal" href="dataflow_pattern.html#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>]</em>) – A list of integers indicating operations that should
not have their type changed, counted starting with the
first valid operation encountered. Negative indices are
allowed and indicate starting at the last layer.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>output_expr</strong> – The graph after recasting to the specified datatype.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>tvm.relay.Expr, tvm.relay.Function, or <a class="reference internal" href="../ir.html#tvm.ir.IRModule" title="tvm.ir.IRModule">tvm.ir.IRModule</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.AlterOpLayout">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">AlterOpLayout</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.AlterOpLayout" title="永久链接至目标">¶</a></dt>
<dd><p>Alternate the layouts of operators or replace primitive operators with
other expressions.
This pass can be used for computing convolution in custom layouts or
other general weight pre-transformation.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass that alters the layout of operators.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.AnnotateSpans">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">AnnotateSpans</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.AnnotateSpans" title="永久链接至目标">¶</a></dt>
<dd><p>Annotate a program with span information by first generating its textual
representation and then parsing it back into a Relay AST annotated with
span information.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered AnnotateSpans pass.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.AnnotateTarget">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">AnnotateTarget</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">targets</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">include_non_call_ops</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.AnnotateTarget" title="永久链接至目标">¶</a></dt>
<dd><p>Annotate ops in an experession with a provied compiler/target and then
use it for codegen.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>targets</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em> or </em><a class="reference internal" href="dataflow_pattern.html#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em>) – The list of target compilers used for codegen.</p></li>
<li><p><strong>include_non_call_ops</strong> (<em>boolean</em>) – If True then non-call ops also will be annotated with targets
If False then non-call ops will not be processed</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The annotated pass that wrapps ops with subgraph_start and
subgraph_end.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.BackwardFoldScaleAxis">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">BackwardFoldScaleAxis</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.BackwardFoldScaleAxis" title="永久链接至目标">¶</a></dt>
<dd><p>Backward fold axis scaling into weights of conv2d/dense.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass to backward fold expressions.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>It is recommended to call backward_fold_scale_axis
before using forward_fold_scale_axis as backward folding targets the common
conv-&gt;bn pattern.</p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.BatchingOps">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">BatchingOps</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.BatchingOps" title="永久链接至目标">¶</a></dt>
<dd><p>Batching parallel operators into one for Conv2D, Dense and BatchMatmul.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The sequential pass which apply batching for different operator types.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.CanonicalizeCast">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">CanonicalizeCast</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.CanonicalizeCast" title="永久链接至目标">¶</a></dt>
<dd><p>Canonicalize cast expressions to make operator fusion more efficient.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass that canonicalizes cast expression.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.CanonicalizeOps">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">CanonicalizeOps</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.CanonicalizeOps" title="永久链接至目标">¶</a></dt>
<dd><p>Canonicalize special operators to basic operators.
This can simplify followed analysis, e.g. expanding bias_add to
expand_dims and broadcast_add.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass performing the canonicalization.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.transform.ChangeBatch">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">ChangeBatch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">batch_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">16</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.ChangeBatch" title="永久链接至目标">¶</a></dt>
<dd><p>Change the batch size.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data</strong> (<a class="reference internal" href="dataflow_pattern.html#tvm.relay.dataflow_pattern.Dict" title="tvm.relay.dataflow_pattern.Dict"><em>Dict</em></a><em>[</em><em>relay.Var</em><em>, </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>]</em>) – A dictionary of all the params to change.
The keys are all params, and the values are which dimension hold the batch.</p></li>
<li><p><strong>batch_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The batch size to change to.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>pass</strong> – The pass.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.transform.FunctionPass" title="tvm.relay.transform.FunctionPass">FunctionPass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.CombineParallelBatchMatmul">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">CombineParallelBatchMatmul</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">min_num_branches</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">3</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.CombineParallelBatchMatmul" title="永久链接至目标">¶</a></dt>
<dd><p>Combine multiple batch matmul operators into one. For example:</p>
<p>Would become:</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>min_num_branches</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The minimum number of required parallel branches for performing this
optimization.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The registered pass that combines parallel dense operators.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.CombineParallelConv2D">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">CombineParallelConv2D</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">min_num_branches</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">3</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.CombineParallelConv2D" title="永久链接至目标">¶</a></dt>
<dd><p>Combine multiple conv2d operators into one.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>min_num_branches</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The minimum number of required parallel branches for performing this
optimization.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The registered pass that combines parallel conv2d operators.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.CombineParallelDense">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">CombineParallelDense</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">min_num_branches</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">3</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">to_batch</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.CombineParallelDense" title="永久链接至目标">¶</a></dt>
<dd><p>Combine multiple dense operators into one. For example:</p>
<p>Would become:</p>
<p>or (if to_batch=False)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>min_num_branches</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The minimum number of required parallel branches for performing this
optimization.</p></li>
<li><p><strong>to_batch_matmul</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – If True, combine parallel dense ops into batch_matmul op.
If False, combine parallel dense ops into dense op.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The registered pass that combines parallel dense operators.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.Conv2dToSparse">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">Conv2dToSparse</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">weight_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">weight_shape</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">layout</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">kernel_size</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.Conv2dToSparse" title="永久链接至目标">¶</a></dt>
<dd><p>Rewrite qualified <code class="docutils literal notranslate"><span class="pre">`nn.conv2d</span> <span class="pre">operation`</span></code> to <code class="docutils literal notranslate"><span class="pre">`nn.sparse_conv2d`</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>weight_name</strong> (<a class="reference internal" href="../ir.html#tvm.ir.Array" title="tvm.ir.Array"><em>Array</em></a><em>[</em><a class="reference internal" href="../runtime.html#tvm.runtime.String" title="tvm.runtime.String"><em>String</em></a><em>]</em>) – Names of weights which qualified sparse contrains</p></li>
<li><p><strong>weight_shape</strong> (<a class="reference internal" href="../ir.html#tvm.ir.Array" title="tvm.ir.Array"><em>Array</em></a><em>[</em><a class="reference internal" href="../ir.html#tvm.ir.Array" title="tvm.ir.Array"><em>Array</em></a><em>[</em><a class="reference internal" href="../tir.html#tvm.tir.IntImm" title="tvm.tir.IntImm"><em>IntImm</em></a><em>]</em><em>]</em>) – Weights shape in BSR format.</p></li>
<li><p><strong>layout</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – layout of data</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The registered DenseToSparse pass.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.Conv2dToSparse2">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">Conv2dToSparse2</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">layout</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">kernel_size</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">blocksize</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sparsity_threshold</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.Conv2dToSparse2" title="永久链接至目标">¶</a></dt>
<dd><p>Rewrite freezed <code class="docutils literal notranslate"><span class="pre">`nn.conv2d`</span></code> operation to <code class="docutils literal notranslate"><span class="pre">`nn.sparse_conv2d`</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>layout</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – layout of data</p></li>
<li><p><strong>kernel_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – kernel size of conv2d</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The registered DenseToSparse pass.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.ConvertLayout">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">ConvertLayout</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">desired_layouts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.ConvertLayout" title="永久链接至目标">¶</a></dt>
<dd><p>Given a dest layout, this pass transforms the expr such that most of the ops input data
layout is changed to the dest layout. In ideal situation, there are only 2 layout transforms,
one at the start and one at the end.</p>
<p>This pass is not a part of relay.build and is expected to be called between framework-relay
parser and relay.build call. This is very helpful for hardware backends that support/prefer only
type of data layout.</p>
<p>RFC - <a class="reference external" href="https://discuss.tvm.apache.org/t/layout-conversion-pass/4009">https://discuss.tvm.apache.org/t/layout-conversion-pass/4009</a></p>
<p>This pass uses most of the AlterOpLayout and InferCorrectLayout infrastructure. We can define
new layouts for conv2d ops for now. Most of the other operators try to adapt to their input
layout using the InferCorrectLayout infrastructure.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>desired_layouts</strong> (<em>map of op_name to list of layouts</em>) – Specify a mapping of operator names to a list of layouts to convert to, in the order
defined by the operator. An example for nn.conv2d could be: {“nn.conv2d”, [“NHWC”, “OHWI]},
where the first item in the list specifies the data layout and the second specifies the
kernel layout.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>pass</strong> – The pass.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.relay.transform.FunctionPass" title="tvm.relay.transform.FunctionPass">FunctionPass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.DeadCodeElimination">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">DeadCodeElimination</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inline_once</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.DeadCodeElimination" title="永久链接至目标">¶</a></dt>
<dd><p>Remove expressions that do not have any users (dead code).</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>inline_once</strong> (<em>Optional</em><em>[</em><em>Bool</em><em>]</em>) – Whether to inline binding that occurs only once.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The registered pass that eliminates the dead code in a Relay program.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.Defunctionalization">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">Defunctionalization</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mod</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.Defunctionalization" title="永久链接至目标">¶</a></dt>
<dd><p>Performs defunctionalization on func,
transforming func from a higher-order program to a first-order program.</p>
<p>At each call site, the function is cloned and type parameters are substituted in.
Function arguments are encoded as datatypes
and additional apply functions are used for application.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>func</strong> (<em>tvm.relay.Function</em>) – The input function, which should not be polymorphic or be higher-order.
This is because all types must be known and we can’t encode function arguments
to the program itself.</p></li>
<li><p><strong>mod</strong> (<em>tvm.IRModule</em>) – The IRModule containing function and type definitions,
which is also mutated during this pass.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>expr</strong> – The output function.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>tvm.relay.Function</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.DefuseOps">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">DefuseOps</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.DefuseOps" title="永久链接至目标">¶</a></dt>
<dd><p>The inverse operation of FuseOps. It transforms a fused program returned by FuseOps into the
program before FuseOps. (i.e., x == DefuseOps(FuseOps(x)))</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass for operator defusion.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.DenseToSparse">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">DenseToSparse</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">weight_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">weight_shape</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.DenseToSparse" title="永久链接至目标">¶</a></dt>
<dd><p>Rewrite qualified <code class="docutils literal notranslate"><span class="pre">`nn.dense</span> <span class="pre">operation`</span></code> to <code class="docutils literal notranslate"><span class="pre">`nn.sparse_dense`</span></code>
This pass is used in <code class="docutils literal notranslate"><span class="pre">`data_dep_optimization.bsr_dense`</span></code>
Parameters of this pass is generated by <code class="docutils literal notranslate"><span class="pre">`analysis.sparse_dense.process_params`</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>weight_name</strong> (<a class="reference internal" href="../ir.html#tvm.ir.Array" title="tvm.ir.Array"><em>Array</em></a><em>[</em><a class="reference internal" href="../runtime.html#tvm.runtime.String" title="tvm.runtime.String"><em>String</em></a><em>]</em>) – Names of weights which qualified sparse contrains</p></li>
<li><p><strong>weight_shape</strong> (<a class="reference internal" href="../ir.html#tvm.ir.Array" title="tvm.ir.Array"><em>Array</em></a><em>[</em><a class="reference internal" href="../ir.html#tvm.ir.Array" title="tvm.ir.Array"><em>Array</em></a><em>[</em><a class="reference internal" href="../tir.html#tvm.tir.IntImm" title="tvm.tir.IntImm"><em>IntImm</em></a><em>]</em><em>]</em>) – Weights shape in BSR format.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The registered DenseToSparse pass.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.DynamicToStatic">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">DynamicToStatic</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.DynamicToStatic" title="永久链接至目标">¶</a></dt>
<dd><p>If possible, convert tvm.relay.dynamic* ops to static versions</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass for dynamic-&gt;static conversion.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.EliminateCommonSubexpr">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">EliminateCommonSubexpr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fskip</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.EliminateCommonSubexpr" title="永久链接至目标">¶</a></dt>
<dd><p>Eliminate common subexpressions.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>fskip</strong> (<a class="reference internal" href="dataflow_pattern.html#tvm.relay.dataflow_pattern.Callable" title="tvm.relay.dataflow_pattern.Callable"><em>Callable</em></a>) – The callback function that decides whether an expression should be
skipped.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The registered pass that eliminates common subexpressions.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.EtaExpand">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">EtaExpand</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expand_constructor</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">expand_global_var</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.EtaExpand" title="永久链接至目标">¶</a></dt>
<dd><p>Add abstraction over a constructor or global variable bound to a function</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>expand_constructor</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether to expand constructors.</p></li>
<li><p><strong>expand_global_var</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether to expand global variables.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The registered pass that eta expands an expression.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.FakeQuantizationToInteger">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">FakeQuantizationToInteger</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.FakeQuantizationToInteger" title="永久链接至目标">¶</a></dt>
<dd><p>Find regions of the graph of the form</p>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>x    w
|    |
dq   dq
 \   /
  op1
   |
  op2
   |
   q
</pre></div>
</div>
<p>where <code class="docutils literal notranslate"><span class="pre">q</span> <span class="pre">==</span> <span class="pre">qnn.quantize</span></code> and <code class="docutils literal notranslate"><span class="pre">dq</span> <span class="pre">=</span> <span class="pre">qnn.dequantize</span></code>
and rewrite them into integer versions of <code class="docutils literal notranslate"><span class="pre">op1</span></code> and <code class="docutils literal notranslate"><span class="pre">op2</span></code></p>
<p>Rules for rewriting indivdual ops are in fake_quantization_to_integer.py</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered SimplifyExpr pass.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.FastMath">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">FastMath</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.FastMath" title="永久链接至目标">¶</a></dt>
<dd><p>Converts the expensive non linear functions to their fast but approximate counterparts.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass to perform fast math operations.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.FirstOrderGradient">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">FirstOrderGradient</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.FirstOrderGradient" title="永久链接至目标">¶</a></dt>
<dd><p>Transforms all global functions in the module to return the original result, paired with the
gradients of the inputs. This pass transforms each global function independently and does not
support interprocedural AD. Additionally, this pass does not support any control-flow or
references, and should only be used on pure data-flow graphs.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered FirstOrderGradient pass.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.FoldConstant">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">FoldConstant</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.FoldConstant" title="永久链接至目标">¶</a></dt>
<dd><p>Fold the constant expressions in a Relay program.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass for constant folding.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.FoldConstantExpr">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">FoldConstantExpr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mod</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.FoldConstantExpr" title="永久链接至目标">¶</a></dt>
<dd><p>Fold the constant expressions in a Relay program.
:param expr: The expression to fold
:type expr: Expr
:param mod: The module the expr lives in (for global calls)
:type mod: IRModule</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>new_expr</strong> – The expr after Constant Folding</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p>Expr</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.FoldExplicitPadding">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">FoldExplicitPadding</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.FoldExplicitPadding" title="永久链接至目标">¶</a></dt>
<dd><p>FoldExplicitPadding finds explict padding before an op that can support
implicit padding and fuses them.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered ImplicitPadding pass.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.FoldScaleAxis">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">FoldScaleAxis</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.FoldScaleAxis" title="永久链接至目标">¶</a></dt>
<dd><p>Fold the scaling of axis into weights of conv2d/dense. This pass will
invoke both forward and backward scale folding.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass to fold expressions.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>Internally, we will call backward_fold_scale_axis before using
forward_fold_scale_axis as backward folding targets the common conv-&gt;bn
pattern.</p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.ForwardFoldScaleAxis">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">ForwardFoldScaleAxis</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.ForwardFoldScaleAxis" title="永久链接至目标">¶</a></dt>
<dd><p>Fold the scaling of axis into weights of conv2d/dense.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass to forward fold expressions.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>It is recommended to call backward_fold_scale_axis
before using forward_fold_scale_axis, as backward folding targets the
common conv-&gt;bn pattern.</p>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.transform.FunctionPass">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">FunctionPass</span></span><a class="headerlink" href="#tvm.relay.transform.FunctionPass" title="永久链接至目标">¶</a></dt>
<dd><p>A pass that works on each tvm.relay.Function in a module. A function
pass class should be created through <cite>function_pass</cite>.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.FuseOps">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">FuseOps</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fuse_opt_level</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.FuseOps" title="永久链接至目标">¶</a></dt>
<dd><p>Fuse operators in an expr to a larger operator according to some rules.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>fuse_opt_level</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The level of fuse optimization. -1 indicates that the level will be
inferred from pass context.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The registered pass for operator fusion.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.InferType">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">InferType</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.InferType" title="永久链接至目标">¶</a></dt>
<dd><p>Infer the type of an expr.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered type inference pass.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.Inline">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">Inline</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.Inline" title="永久链接至目标">¶</a></dt>
<dd><p>Perform inlining on the given Relay IR module. The global functions that
are marked as <cite>inline</cite> should be always inlined. A cost model will be
needed in the future to decide if it is profitable to inline the function.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass that performs inlining for a Relay IR module.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.LambdaLift">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">LambdaLift</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.LambdaLift" title="永久链接至目标">¶</a></dt>
<dd><p>Lift the closure to global function.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass that lifts the lambda function.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.relay.transform.LayoutConfig">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">LayoutConfig</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">skip_layers</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.LayoutConfig" title="永久链接至目标">¶</a></dt>
<dd><p>A structure for customizing the ConvertLayout pass.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.LazyGradientInit">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">LazyGradientInit</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.LazyGradientInit" title="永久链接至目标">¶</a></dt>
<dd><p>Reduces memory usage of gradient tensors</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – A pass which delays and/or reduces memory allocation,
by lazily allocating 0 or one filled tensors.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.Legalize">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">Legalize</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">legalize_map_attr_name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'FTVMLegalize'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.Legalize" title="永久链接至目标">¶</a></dt>
<dd><p>Legalizes an expression with another expression.
This pass can be used to replace an expr with another expr for target
dependent optimizations. For example, one expr, though semnatically
equivalent to the other, can have better performance on a target. This pass
can be used to legalize the expr in a target-dependent manner.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>legalize_map_attr_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The Op’s attr name which corresponds to the legalize rule function.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The registered pass that rewrites an expr.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.MergeCompilerRegions">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">MergeCompilerRegions</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.MergeCompilerRegions" title="永久链接至目标">¶</a></dt>
<dd><p>Merge together compiler regions.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass that merges compiler regions.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.MergeComposite">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">MergeComposite</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pattern_table</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.MergeComposite" title="永久链接至目标">¶</a></dt>
<dd><p>Merge multiple operators into a single composite relay function.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>pattern_table</strong> (<a class="reference internal" href="dataflow_pattern.html#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><em>Tuple</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><a class="reference internal" href="dataflow_pattern.html#tvm.relay.dataflow_pattern.DFPattern" title="tvm.relay.dataflow_pattern.DFPattern"><em>tvm.relay.dataflow_pattern.DFPattern</em></a><em>, </em><em>Function</em><em>]</em><em>]</em>) – A list of (pattern_name, pattern, check) tuples.
The order of the patterns in the list will determine the order
of priority in which they are matched.
‘check’ is a function to check whether an extracted pattern matches.
It can be implemented by pattern writer but if not specified it will
always return True.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The registered pass that merges operators into a single composite
relay function.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.PartialEvaluate">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">PartialEvaluate</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.PartialEvaluate" title="永久链接至目标">¶</a></dt>
<dd><p>Evaluate the static fragment of the code.</p>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>This transformation could be either <cite>Module -&gt; Module</cite> or <cite>Expr -&gt; Expr</cite>.
It will directly transform the input expression to a new one if the target
expression is provided. Otherwise, it will rely on the pass manager to
carry out transformation.</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass that performs partial evaluation on an expression.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.PartitionGraph">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">PartitionGraph</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mod_name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'default'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.PartitionGraph" title="永久链接至目标">¶</a></dt>
<dd><p>Partition a Relay program into regions that can be executed on different
backends.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass that partitions the Relay program.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.PlanDevices">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">PlanDevices</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">default_device</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.PlanDevices" title="永久链接至目标">¶</a></dt>
<dd><p>Uses existing “on_device” and “device_copy” CallNodes to infer the device on which
every Relay sub-expression should run (and the result stored). Captures the result of that
analysis using new “on_device” and “device_copy” CallNodes. Note that the device_id of
the default_device is ignored.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.RemoveUnusedFunctions">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">RemoveUnusedFunctions</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">entry_functions</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.RemoveUnusedFunctions" title="永久链接至目标">¶</a></dt>
<dd><p>Remove unused global relay functions in a relay module.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>entry_functions</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(在 Python v3.10)"><em>list</em></a><em>[</em><em>string</em><em>]</em>) – The set of entry functions to start from.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The registered pass to remove unused functions.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.SimplifyExpr">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">SimplifyExpr</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.SimplifyExpr" title="永久链接至目标">¶</a></dt>
<dd><p>Simplify the Relay expression, including merging consecutive reshapes.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered SimplifyExpr pass.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.SimplifyFCTranspose">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">SimplifyFCTranspose</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target_weight_name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.SimplifyFCTranspose" title="永久链接至目标">¶</a></dt>
<dd><p>Rewrite <code class="docutils literal notranslate"><span class="pre">`y</span> <span class="pre">=</span> <span class="pre">nn.dense(x,</span> <span class="pre">transpose(w,</span> <span class="pre">[1,</span> <span class="pre">0]))`</span></code> to <code class="docutils literal notranslate"><span class="pre">`y</span> <span class="pre">=</span> <span class="pre">nn.dense(x,</span> <span class="pre">wt)`</span></code>
This pass is used in <code class="docutils literal notranslate"><span class="pre">`data_dep_optimization.simplify_fc_transpose`</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>weight_name</strong> (<a class="reference internal" href="../ir.html#tvm.ir.Array" title="tvm.ir.Array"><em>Array</em></a><em>[</em><a class="reference internal" href="../runtime.html#tvm.runtime.String" title="tvm.runtime.String"><em>String</em></a><em>]</em>) – Names of weights which qualified <code class="docutils literal notranslate"><span class="pre">`y</span> <span class="pre">=</span> <span class="pre">nn.dense(x,</span> <span class="pre">transpose(w,</span> <span class="pre">[1,</span> <span class="pre">0]))`</span></code>
This parameter is generated by <code class="docutils literal notranslate"><span class="pre">`analysis.search_fc_transpose`</span></code> function</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The registered SimplifyFCTranspose pass.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.SimplifyInference">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">SimplifyInference</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.SimplifyInference" title="永久链接至目标">¶</a></dt>
<dd><p>Simplify the data-flow graph for inference phase. An simplified expression
which is semantically equal to the input expression will be returned.</p>
<p>Note that batch norms will only be simplified if their result is indexed at
tuple index 0.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass to perform operator simplification.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.SplitArgs">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">SplitArgs</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">max_function_args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.SplitArgs" title="永久链接至目标">¶</a></dt>
<dd><p>Split function with huge number of arguments to smaller pieces.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass for constant folding.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.ToANormalForm">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">ToANormalForm</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.ToANormalForm" title="永久链接至目标">¶</a></dt>
<dd><p>Turn Graph Normal Form expression into A Normal Form Expression.
The scope of the root expression is the global scope.
The scope of any non root expression is the least common ancestor of all it’s scope.
Values are ordered by post-DFS order in each scope.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass that transforms an expression into A Normal Form.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p>Union[<a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a>, tvm.relay.Expr]</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.ToANormalFormExpr">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">ToANormalFormExpr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">e</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.ToANormalFormExpr" title="永久链接至目标">¶</a></dt>
<dd><p>ToANormalForm, but on expression level.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>e</strong> (<em>Expr</em>) – The graph expression.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The transformed expresion.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>Expr</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.ToBasicBlockNormalForm">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">ToBasicBlockNormalForm</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.ToBasicBlockNormalForm" title="永久链接至目标">¶</a></dt>
<dd><p>Turn an expression to Basic Block Normal Form.
We define a block as a group of expressions implied by the scope structure.
Each graph node can only belong to a single block.
For any value that is being used in multiple blocks, it has to be referred
by a Var which is defined in a block, whose scope is the least common ancestor
of blocks this value is used.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass that transforms an expression into Basic Block Normal Form.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.ToCPS">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">ToCPS</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mod</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.ToCPS" title="永久链接至目标">¶</a></dt>
<dd><p>Turn expression into continuation passing style(CPS).</p>
<p>Every intermediate compute will be passed to a continuation.</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>result</strong> – The registered pass that transforms an expression into CPS.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.ToGraphNormalForm">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">ToGraphNormalForm</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.ToGraphNormalForm" title="永久链接至目标">¶</a></dt>
<dd><p>Turn a Relay program in A Normal Form into Graph Normal Form</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>ret</strong> – The registered pass that transforms an expression into Graph Normal Form.</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.ToMixedPrecision">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">ToMixedPrecision</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mixed_precision_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'float16'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">missing_op_mode</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.ToMixedPrecision" title="永久链接至目标">¶</a></dt>
<dd><p>Automatic mixed precision rewriter. Rewrite an FP32 relay graph into a version
where as many operations as possible are in the target mixed_precision_type.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>mixed_precision_type</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The target datatype to transform operations in the graph to use.</p></li>
<li><p><strong>missing_op_mode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – <dl class="simple">
<dt>Determines how to handle ops not registered with FTVMMixedPrecisionConversionType</dt><dd><p>0: Does not allow any missing ops. Will throw errors when encountering any.
1: Allow missing ops but emit warnings.
2: Allow missing ops and silently ignore them.</p>
</dd>
</dl>
</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The registered pass.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.Pass" title="tvm.transform.Pass">tvm.transform.Pass</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.build_config">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">build_config</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opt_level</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">required_pass</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">disabled_pass</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">trace</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.build_config" title="永久链接至目标">¶</a></dt>
<dd><p>Configure the build behavior by setting config variables. This function
will be deprecated in TVM v0.7. Instead, we should directly use
tvm.transform.PassContext.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>opt_level</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>, </em><em>optional</em>) – <p>Optimization level. The optimization pass name and level are as the
following:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">OPT_PASS_LEVEL</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s2">&quot;SimplifyInference&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
    <span class="s2">&quot;OpFusion&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
    <span class="s2">&quot;FoldConstant&quot;</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
    <span class="s2">&quot;FoldScaleAxis&quot;</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
    <span class="s2">&quot;AlterOpLayout&quot;</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
    <span class="s2">&quot;CanonicalizeOps&quot;</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
    <span class="s2">&quot;CanonicalizeCast&quot;</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
    <span class="s2">&quot;EliminateCommonSubexpr&quot;</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
    <span class="s2">&quot;CombineParallelConv2D&quot;</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
    <span class="s2">&quot;CombineParallelDense&quot;</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
    <span class="s2">&quot;CombineParallelBatchMatmul&quot;</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
    <span class="s2">&quot;FastMath&quot;</span><span class="p">:</span> <span class="mi">4</span>
<span class="p">}</span>
</pre></div>
</div>
</p></li>
<li><p><strong>required_pass</strong> (<em>set of str</em><em>, </em><em>optional</em>) – Optimization passes that are required regardless of optimization level.</p></li>
<li><p><strong>disabled_pass</strong> (<em>set of str</em><em>, </em><em>optional</em>) – Optimization passes to be disabled during optimization.</p></li>
<li><p><strong>trace</strong> (<a class="reference internal" href="dataflow_pattern.html#tvm.relay.dataflow_pattern.Callable" title="tvm.relay.dataflow_pattern.Callable"><em>Callable</em></a><em>[</em><em>[</em><a class="reference internal" href="../ir.html#tvm.ir.IRModule" title="tvm.ir.IRModule"><em>IRModule</em></a><em>, </em><a class="reference internal" href="../ir.html#tvm.transform.PassInfo" title="tvm.transform.PassInfo"><em>PassInfo</em></a><em>, </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a><em>]</em><em>, </em><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(在 Python v3.10)"><em>None</em></a><em>]</em>) – A tracing function for debugging or introspection.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>pass_context</strong> – The pass context for optimizations.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="../ir.html#tvm.transform.PassContext" title="tvm.transform.PassContext">PassContext</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.function_pass">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">function_pass</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pass_func</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">opt_level</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">required</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.function_pass" title="永久链接至目标">¶</a></dt>
<dd><p>Decorate a function pass.</p>
<p>This function returns a callback when pass_func
is provided. Otherwise, it returns the created function pass using the
given optimization function.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pass_func</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="dataflow_pattern.html#tvm.relay.dataflow_pattern.Callable" title="tvm.relay.dataflow_pattern.Callable"><em>Callable</em></a><em>[</em><em>(</em><em>Function</em><em>, </em><a class="reference internal" href="../runtime.html#tvm.runtime.Module" title="tvm.runtime.Module"><em>Module</em></a><em>, </em><a class="reference internal" href="../ir.html#tvm.transform.PassContext" title="tvm.transform.PassContext"><em>PassContext</em></a><em>) </em><em>-&gt; Function</em><em>]</em><em>]</em>) – The transformation function or class.</p></li>
<li><p><strong>opt_level</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The optimization level of this module pass.</p></li>
<li><p><strong>name</strong> (<em>Optional</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em>) – The name of the function pass. The name could be empty. In this case, the
name of the optimization function will be used as the pass name.</p></li>
<li><p><strong>required</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="dataflow_pattern.html#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>]</em><em>]</em>) – The list of passes that the module pass is dependent on.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>create_function_pass</strong> – A decorator will be returned if pass_func is not provided,
otherwise return the decorated result.
The returned decorator has two behaviors depending on the input:
A new FunctionPass will be returned when we decorate a pass function.
A new FunctionPass class will be returned when we decorate a class type.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>Union[<a class="reference internal" href="dataflow_pattern.html#tvm.relay.dataflow_pattern.Callable" title="tvm.relay.dataflow_pattern.Callable">Callable</a>, <a class="reference internal" href="#tvm.relay.transform.FunctionPass" title="tvm.relay.transform.FunctionPass">FunctionPass</a>]</p>
</dd>
</dl>
<p class="rubric">实际案例</p>
<p>The following code block decorates a function pass class.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="nd">@relay.transform.function_pass</span><span class="p">(</span><span class="n">opt_level</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">TestReplaceFunc</span><span class="p">:</span>
    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">new_func</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">new_func</span> <span class="o">=</span> <span class="n">new_func</span>

    <span class="k">def</span> <span class="nf">transform_function</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">func</span><span class="p">,</span> <span class="n">mod</span><span class="p">,</span> <span class="n">ctx</span><span class="p">):</span>
        <span class="c1"># just for demo purposes</span>
        <span class="c1"># transform func to new_func</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">new_func</span>

<span class="n">x</span> <span class="o">=</span> <span class="n">relay</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="s2">&quot;x&quot;</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
<span class="n">f1</span> <span class="o">=</span> <span class="n">relay</span><span class="o">.</span><span class="n">Function</span><span class="p">([</span><span class="n">x</span><span class="p">],</span> <span class="n">x</span><span class="p">)</span>
<span class="n">f2</span> <span class="o">=</span> <span class="n">relay</span><span class="o">.</span><span class="n">Function</span><span class="p">([</span><span class="n">x</span><span class="p">],</span> <span class="n">relay</span><span class="o">.</span><span class="n">log</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
<span class="c1"># fpass is now a special pass that replaces every</span>
<span class="c1"># function to f1</span>
<span class="n">fpass</span> <span class="o">=</span> <span class="n">TestReplaceFunc</span><span class="p">(</span><span class="n">f1</span><span class="p">)</span>
<span class="c1"># now every function in input_mod is replaced by f1</span>
<span class="n">res_mod</span> <span class="o">=</span> <span class="n">fpass</span><span class="p">(</span><span class="n">input_mod</span><span class="p">)</span>
</pre></div>
</div>
<p>The following code creates a function pass by decorating
a user defined transform function.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="nd">@relay.transform.function_pass</span><span class="p">(</span><span class="n">opt_level</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">transform</span><span class="p">(</span><span class="n">func</span><span class="p">,</span> <span class="n">mod</span><span class="p">,</span> <span class="n">ctx</span><span class="p">):</span>
    <span class="c1"># my transformations here.</span>
    <span class="k">return</span> <span class="n">func</span>

<span class="n">function_pass</span> <span class="o">=</span> <span class="n">transform</span>
<span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">function_pass</span><span class="p">,</span> <span class="n">transform</span><span class="o">.</span><span class="n">FunctionPass</span><span class="p">)</span>
<span class="k">assert</span> <span class="n">function_pass</span><span class="o">.</span><span class="n">info</span><span class="o">.</span><span class="n">opt_level</span> <span class="o">==</span> <span class="mi">2</span>

<span class="c1"># Given a module m, the optimization could be invoked as the follwoing:</span>
<span class="n">updated_mod</span> <span class="o">=</span> <span class="n">function_pass</span><span class="p">(</span><span class="n">m</span><span class="p">)</span>
<span class="c1"># Now constant folding should have been applied to every function in</span>
<span class="c1"># the provided module m. And the updated module will be returned.</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.gradient">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">gradient</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mod</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mode</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'higher_order'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.gradient" title="永久链接至目标">¶</a></dt>
<dd><p>Transform the input function,
returning a function that calculate the original result,
paired with gradient of the input.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>expr</strong> (<em>tvm.relay.Expr</em>) – The input expression, which is a Function or a GlobalVar.</p></li>
<li><p><strong>mod</strong> (<em>Optional</em><em>[</em><em>tvm.IRModule</em><em>]</em>) – </p></li>
<li><p><strong>mode</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="../runtime.html#tvm.runtime.String" title="tvm.runtime.String"><em>String</em></a><em>]</em>) – The mode of the automatic differentiation algorithm.
‘first_order’ only works on first order code, but will not produce
reference nor closure.
‘higher_order’ works on all code using reference and closure.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>expr</strong> – The transformed expression.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>tvm.relay.Expr</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.to_cps">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">to_cps</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mod</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.to_cps" title="永久链接至目标">¶</a></dt>
<dd><p>Turn expression into CPS expression.</p>
<p>Every intermediate compute will be passed to a continuation.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>func</strong> (<em>tvm.relay.Function</em>) – The input function.</p></li>
<li><p><strong>mod</strong> (<em>Optional</em><em>[</em><em>tvm.IRModule</em><em>]</em>) – The global module.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The output function.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>tvm.relay.Function</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.relay.transform.un_cps">
<span class="sig-prename descclassname"><span class="pre">tvm.relay.transform.</span></span><span class="sig-name descname"><span class="pre">un_cps</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">func</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.relay.transform.un_cps" title="永久链接至目标">¶</a></dt>
<dd><p>Turn an cps function into a Function without the continuation argument.</p>
<dl class="simple">
<dt>Note that this will not give the exact same interface as before cps:</dt><dd><p>If the input/output is higher order, they will still be in cps form.</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>func</strong> (<em>tvm.relay.Function</em>) – The input function</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>result</strong> – The output function</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>tvm.relay.Function</p>
</dd>
</dl>
</dd></dl>

</div>


           </div>
           
          </div>
          

<footer>

    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="analysis.html" class="btn btn-neutral float-right" title="tvm.relay.analysis" accesskey="n" rel="next">下一个 <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="image.html" class="btn btn-neutral float-left" title="tvm.relay.image" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> 上一个</a>
      
    </div>

<div id="button" class="backtop"><img src="../../../../_static//img/right.svg" alt="backtop"/> </div>
<section class="footerSec">
    <div class="footerHeader">
      <ul class="d-flex align-md-items-center justify-content-between flex-column flex-md-row">
        <li class="copywrite d-flex align-items-center">
          <h5 id="copy-right-info">© 2020 Apache Software Foundation | All right reserved</h5>
        </li>
      </ul>

    </div>

    <ul>
      <li class="footernote">Copyright © 2020 The Apache Software Foundation. Apache TVM, Apache, the Apache feather, and the Apache TVM project logo are either trademarks or registered trademarks of the Apache Software Foundation.</li>
    </ul>

</section>
</footer>
        </div>
      </div>

    </section>

  </div>
  

    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

  </body>
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
    <!-- Theme Analytics -->
    <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-75982049-2', 'auto');
    ga('send', 'pageview');
    </script>

    
   

</body>
</html>